<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>

<div class="red">红盒子</div>
<div class="blue red">蓝盒子</div>
<div class="green red">绿盒子</div>
<script>
var divs = document.getElementsByClassName("red");
for(var i=0; i<divs.length;i++){
	console.log(divs[i].innerHTML);
}


</script>




</body>
</html>
